package com.hyw.cm.common.dto;

import java.util.Map;
import java.util.Objects;

/**
 * 充当Entry的实现，又充当一个简单的二元组
 * 
 * @author Hongyu
 * @param <K>
 * @param <V>
 */
public class CEntry<K, V> implements Map.Entry<K, V> {

  private K k;
  private V v;

  public CEntry(K k, V v) {
    super();
    Objects.requireNonNull(k);
    this.k = k;
    this.v = v;
  }

  @Override
  public K getKey() {
    return k;
  }

  @Override
  public V getValue() {
    return v;
  }

  @Override
  public V setValue(V value) {
    V old = this.v;
    this.v = value;
    return old;
  }
}